/ Assembly List / LJCTextDataReaderLib / TextDataReader / LJCSetLines

Namespace - LJCTextDataReaderLib


Parameters
lines - The lines.
fieldDelimiter - The field delimiter.

Syntax

C#
public Void LJCSetLines(String[] lines, Char fieldDelimiter = ,)

Set the source line string array. (RE)

Remarks

A string array can be loaded by the program and read instead of a file. Use the LJCReadLine() method to read through the array instead of the Read() method that is used for a file.

Example

C#
using LJCTextDataReaderLib;

// The hasHeadingLine defaults to true if the parameter is not included.
TextDataReader textReader = new TextDataReader();

string[] lines = new string[]
{
  "FirstName, LastName",
  "John, Doe",
  "Jane, Doe"
};

// The field delimiter defaults to "," if the parameter is not included.
textReader.LJCSetLines(lines);

while(textReader.ReadLine())
{
  // Get the current line values as strings.
  for int index = 0; index < textReader.FieldCount; index++)
  {
    string data = textReader.GetString(index);
  }
}

Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.